package com.enterprise.projectManager.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
public class Contract {
    @ManyToOne
    @JoinColumn(name = "project_id")
    private Project project;
    @Id
    private String contractId;
    private String contractName;
    private String contractNature;
    private String contractType;
    private Double contractCost;
    private String contractState;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date contractSigndate;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date contractStartdate;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date contractEnddate;
    private String contractWay;
    private String contractFirstcompany;
    private String contractSecondcompany;
    private Double contractPrepaid;
    private String firstcompanyManager;
    private String firstcompanyManagerPhone;
    private String secondcompanyManager;
    private String secondcompanyManagerPhone;
    private String contractPay;
    @JsonIgnore
    @OneToMany(mappedBy = "contract",cascade = CascadeType.ALL)
    private List<PayProgress> payProgresses =new ArrayList<>();
}

